---
title: "Jenkins"
slug: /getting-started/ci-integrations/jenkins
description: "Learn how to use Dagger with Jenkins."
---

# Jenkins

Dagger provides a programmable container engine that allows you to replace your Groovy-based Jenkins pipelines with with Dagger Functions written in a regular programming language. This allows you to execute your pipeline the same locally and in Jenkins, with intelligent caching, while keeping all of your existing Jenkins infrastructure.

## How it works

There are many ways to run Dagger on Jenkins. The simplest way to get started is having a Jenkins agent with OCI compatible container runtime.

The general workflow looks like this:

1. Jenkins receives job trigger as usual.
1. Jenkins loads `Jenkinsfile` from repository or from UI configuration.
1. Jenkins parses the Groovy-based `Jenkinsfile` and downloads the Dagger CLI.
1. Jenkins find and executes one (or more) Dagger CLI commands, such as `dagger call ...`.
1. The Dagger CLI attempts to find an existing Dagger Engine or spins up a new one inside the Jenkins agent.
1. The Dagger CLI calls the specified Dagger Function and sends telemetry to Dagger Cloud if the `DAGGER_CLOUD_TOKEN` environment variable is set.
1. Job completes with success or failure, pipeline logs appear in Jenkins as usual

## Prerequisites

Running the examples shown below requires:

1. At least one Jenkins agent with the `dagger` label
1. A Docker engine that is able to run containers (can be `docker:dind`)
1. The `docker` client installed on your Jenkins agent

## Example

The following code sample demonstrates how to integrate Dagger with Jenkins.

```groovy title="Jenkinsfile" file=./snippets/Jenkinsfile template
```

## Resources

If you have any questions about additional ways to use Jenkins with Dagger, join our [Discord](https://discord.gg/dagger-io) and ask your questions in our [Jenkins channel](https://discord.com/channels/707636530424053791/1149487212069670974).

- [Introduction to running Dagger Pipelines with Jenkins](https://youtu.be/vuEBx_s1sgs) by Lev Lazinskiy. In this demo, he shows how to integrate Dagger pipelines with Jenkins. He explains the setup process for a Jenkins pipeline using Dagger and covers both a simple and a modular approach to managing CI pipelines effectively.

## About Jenkins

[Jenkins](https://www.jenkins.io/) is an open-source automation server that enables teams to automate the build, test, and deploy processes of software projects. Jenkins supports many plugins that integrate with various tools, making it a popular choice for Continuous Integration and Continuous Deployment.
